<?php

session_start();
Echo "<b><center><h2><span style='color: red'><strong>Gues number </strong></span> </h2></center></b>"; 
Echo "<pre> "; 
Echo "<b><center><span style='color: blue'><strong>Arvuti motleb juhuslikult yhe arvu 1-1000 vahel.
 Kasutaja saab lahtrisse sisestada arvu.
 Arvuti ytleb, et kas oige on sisestatust suurem voi vaiksem.
 Mang kestab kuni kasutaja arvab oige ara.
 Arvuti annab oige ara arvamisest teada.
 Edasi saab alustada uut mangu</strong></span></center></b>";
Echo "<pre>";
 if (!$_SESSION['vastus']) {
        $_SESSION['rand']=rand(1,1000);
        $_SESSION['vastus']=true;
         }
if ($_POST['guess']>$_SESSION['rand']){
         $msg= "Ei minu arv on vaiksem";
 }
 elseif ($_POST['guess']<$_SESSION['rand']){
        $msg="ei minu arv on suurem";
 }
 
 else {
        $msg="Yea you are win. Play again!";
        $_SESSION['vastus']=false;
 }


?>
<html>
<title>Game</title>
<head>
<center>
<h2> <?php echo $msg."<br>"; ?> </h2>
<form method="post">
 
<input type="text" name="guess" />
<input type="submit" value="sisesta" />
 <input type="submit" value="allusta uus mang" />
</form>
</center>
</body>
</html>
